<!DOCTYPE html>
<html class="x-admin-sm">
<head>
    <meta charset="UTF-8">
    <title>安伴后台管理系统-交易记录列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-nav">
          <span class="layui-breadcrumb">
            <a href="{{urlfor "admin.IndexController.Index"}}">首页</a>
            <a><cite>交易记录</cite></a>
          </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="{{urlfor "admin.FinanceController.ShowList"}}" title="刷新">
        <i class="layui-icon layui-icon-refresh" style="line-height:30px"></i></a>
</div>
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-body">
                    <form class="layui-form layui-col-space5" id="search-form" method="post" action="{{urlfor "admin.FinanceController.ShowList"}}">
                        {{.xsrfdata}}
                        <div class="layui-input-inline layui-show-xs-block">
                            <input class="layui-input" placeholder="开始日期" name="start_time" id="start_time" value="{{.startTime}}">
                        </div>
                        <div class="layui-input-inline layui-show-xs-block">
                            <input class="layui-input" placeholder="结束日期" name="end_time" id="end_time" value="{{.endTime}}">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <select id="type" name="type" lay-verify="">
                                <option value="">交易类型</option>
                                {{range $key, $val := .typeList}}
                                    <option value="{{$key}}" {{if eq $key $.type}}selected{{end}}>{{$val}}</option>
                                {{end}}
                            </select>
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="phone" value="{{.phone}}" placeholder="请输入交易人电话" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <input type="text" name="real_name" value="{{.realName}}" placeholder="请输入交易人姓名" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-inline layui-show-xs-block">
                            <button class="layui-btn"  lay-submit="" lay-filter="search"><i class="layui-icon">&#xe615;</i></button>
                        </div>
                        <input type="hidden" name="p" id="cur-page" value="1">
                    </form>
                </div>
                <div class="layui-card-body ">
                    <span style="color: #666666;font-weight: bold;margin-left: 3px;">交易总金额：</span>
                    <span style="color: #ff6666;font-size: 14px;">{{.totalAmount | printf "%.2f"}}</span>
                    <table class="layui-table layui-form">
                        <thead>
                        <tr>
                            <th>ID</th>
                            <th>交易人</th>
                            <th>交易类型</th>
                            <th>交易金额</th>
                            <th>交易时间</th>
                        </thead>
                        <tbody>
                        {{range .recordList}}
                            <tr>
                                <td>{{.Id}}</td>
                                <td>{{.User.RealName}} {{.User.Phone}}</td>
                                <td>{{.TypeShow}}</td>
                                <td>{{.Amount | printf "%.2f"}}</td>
                                <td>{{.CreatedShow}}</td>
                            </tr>
                        {{else}}
                            <tr>
                                <td colspan="100" style="text-align: center;font-weight: bold;color: #ff6666;">没有数据</td>
                            </tr>
                        {{end}}
                        </tbody>
                    </table>
                </div>
                <div class="layui-card-body ">
                    <div class="page">
                        <div>
                            {{str2html .paginator}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>

    var canSubmit = true;

    layui.use(['laydate', 'form'], function () {

        $ = layui.jquery;
        var form = layui.form,
            laydate = layui.laydate;

        laydate.render({
            elem: '#start_time'
        });

        laydate.render({
            elem: '#end_time'
        });

        $(".page").on("click", "a", function () {
            var n = $(this).attr("page-num");
            $("#cur-page").val(n);
            $("#search-form").submit();
        });

        form.on("submit(search)", function () {
            $("#cur-page").val(1);
            $("#search-form").submit();
        });

    });

</script>
</html>